<?php
namespace app\index\controller;
use think\Db;

class Article extends Base
{
	public function initialize(){
	    parent::initialize();
	}
    public function index()
    {	$id = request()->param('id');
		$article = $this->getArticle($id);
		$this->assign('article_tag',$this->getTagList(explode(",",$article['tag'])));
		$this->assign('article',$article);
		$this->assign('prev',$this->getPrevNext($id,'<'));
		$this->assign('next',$this->getPrevNext($id,'>'));
		return $this->fetch();
    }
	protected function getArticle($id){
		$list = Db::name('article')->where(['status'=>1,'id'=>$id])->find();
		return $list;
	}
}
